import java.util.Arrays;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86183
 * Date: 2023-03-16
 * Time: 17:46
 */
public class test04 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] left = new int[n];
        int[] right = new int[n];
        for (int i = 0; i < n; i++) {
            left[i] = scan.nextInt();
        }
        for (int i = 0; i < n; i++) {
            right[i] = scan.nextInt();
        }
//        System.out.println(Arrays.toString(left));
//        System.out.println(Arrays.toString(right));
        System.out.println(findMinimum(n,left,right));
    }

    private  static  int findMinimum(int n, int[] left, int[] right) {
        int leftSum = 0;
        int rightSum = 0;
        int leftMin = Integer.MAX_VALUE;
        int rightMin = Integer.MAX_VALUE;
        int sum = 0;
        for (int i = 0; i < n; i++) {
            if(left[i] * right[i] == 0){
                sum += left[i] + right[i];
            }else{
                leftSum += left[i];
                rightSum += right[i];
                if(leftMin > left[i]){
                    leftMin = left[i];
                }
                if(rightMin > right[i]){
                    rightMin = right[i];
                }

            }
        }
        return sum + Math.min(leftSum - leftMin + 1,rightSum - rightMin + 1) + 1;

    }
}
